home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / ACORNUSERS / CBSA / EDUCATION / TAPEFILE / !TapeFile / cc / Test
Text File  |  1998-10-24  |  1KB  |  80 lines

  1.  
  2. //-----------------------------------
  3. //             Test.c
  4. //-----------------------------------
  5.  
  6. #include <stdio.h>
  7. #include "swis.h"
  8. #include "kernel.h"
  9.  
  10. #include "WimpError.h"
  11. #include "WimpTask.h"
  12. #include "WimpIcon.h"
  13.  
  14. class MyTask : public WimpTask
  15. {
  16.   public:
  17.   
  18.   MyTask(char *);
  19.   bool ButtonPressed();
  20.   bool load(char *, int, int);
  21. };
  22.  
  23. MyTask::MyTask(char *name) : WimpTask(name) 
  24. {
  25.   EnableEvent(EBUT);
  26. }
  27.  
  28. bool MyTask::ButtonPressed()
  29. {
  30.   if (Mouse_Click.window = -2) return(TRUE);
  31.   return(FALSE);
  32. }
  33.  
  34. bool MyTask::load(char *filename, int size, int type)
  35. {
  36.   FILE *fp;
  37.   int c,i;
  38.   int block[128];
  39.   _kernel_swi_regs r;
  40.  
  41.   i=0;
  42.   fp = fopen(filename,"r");
  43.   if (fp == NULL) my_throw("Impossible d'ouvrir le fichier");
  44.   while(( c = fgetc(fp)) != EOF)
  45.   {
  46.     if( (_kernel_osbyte(138,0,c) & 0xff0000) )  // PRM 1-168
  47.     {
  48.       while( !(_kernel_osbyte(152,0,0) & 0xff0000))
  49.       {
  50.         r.r[0] = 0xE1830;    //0xE1831
  51.         r.r[1] = (int) block;
  52.         _kernel_swi(Wimp_Poll, &r,&r);
  53.       }
  54.     }
  55. /*    i++;
  56.     if (i == 255)
  57.     { 
  58.       i=0;
  59.       r.r[0] = 1;
  60.       r.r[1] = 0;
  61.       r.r[2] = c;
  62.       _kernel_swi(OS_GenerateEvent, &r, &r);
  63.       while( !(_kernel_osbyte(152,0,0) & 0xff0000));
  64.     }*/
  65.   }
  66.   return FALSE;
  67. }
  68.  
  69. int main()
  70. {
  71.   MyTask a("CouCou"); 
  72.   WimpIcon b("my_sprite");
  73.   a.run();
  74. }
  75.  
  76.  
  77.  
  78.  
  79.  
  80.